#include<iostream>
using namespace std;
typedef long long LL;
const int N = 110;
int a[N];
int n;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		int x1, x2, y1, y2;
		cin >> x1 >> x2 >> y1 >> y2;
		cout << x1 << " ";
		int ans = 0;
		for (int i = y1; i <= y2; i++) {
			if (i != x1) {
				ans = i;
				break;
			}
		}
		cout << ans << endl;
	}
	return 0;
}